<template>
	<div>
		<van-nav-bar :title="title" left-text="返回" left-arrow @click-left="onClickLeft" />
		<div class="newInfo">
			<div class="markDiv" v-html="newInfo.content"></div>
		</div>

		
		<div class="onload_div" v-if="newInfo == ''">
			
			<van-loading size="24px">加载中...</van-loading>
			
		</div>	
	
		<img v-if="newInfo == null" src="../../../assets/images/noNews.png" alt="">
	</div>
</template>

<script>
	import Vue from 'vue';
	import {
		NavBar,
		Loading
	} from 'vant';
	import {
		details
	} from '../../../api/store.js'
	Vue.use(NavBar);
	// Vue.user(Loading);

	export default {
		components: {
			NavBar
		},
		created() {
			this.getNewInfo()
		},
		data() {
			return {
				newInfo: "",

				title: "新闻详情"
			}
		},
		methods: {
			getNewInfo() {

				details(this.$route.query.id).then((res) => {

					this.newInfo = res.data

					this.title = res.data.title

				}).catch(() => {

					this.newInfo = null

				})

			},

			onClickLeft() {
				this.$router.go(-1)
			}
		}
	}
</script>

<style lang="scss">
	.markDiv {
		padding: .2rem;
		box-sizing: border-box;
	}

	.markDiv img,
	.markDiv video {
		width: 98% !important;
	}
</style>
